package com.xbongbong.paas.script.pojo;

import com.xbongbong.paas.constant.PaasConstant;
import lombok.Getter;
import lombok.Setter;

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

/**
 * @author feng.zheng
 * @version v1.0
 * @Date 2020/3/17 16:09
 * @since v1.0
 */
@Getter
@Setter
public class ProductUserComparePojo {
    private Long parentId;

    private Long dataId;

    private Integer type;

    private String relationId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ProductUserComparePojo)) return false;
        ProductUserComparePojo that = (ProductUserComparePojo) o;
        return getParentId().equals(that.getParentId()) &&
                getDataId().equals(that.getDataId()) &&
                getType().equals(that.getType()) &&
                getRelationId().equals(that.getRelationId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getParentId(), getDataId(), getType(), getRelationId());
    }

    public ProductUserComparePojo(Long parentId, Long dataId, Integer type, String relationId) {
        this.parentId = parentId;
        this.dataId = dataId;
        this.type = type;
        this.relationId = relationId;
    }

    public static void main(String[] args) {
        ProductUserComparePojo productUserComparePojo = new ProductUserComparePojo(1L, 1L, 1, "23");
        ProductUserComparePojo productUserComparePojo2 = new ProductUserComparePojo(1L, 1L, 1, "23");
        Set<ProductUserComparePojo> set = new HashSet<>(PaasConstant.DEFAULT_INITIAL_CAPACITY);
        set.add(productUserComparePojo);
        set.add(productUserComparePojo2);
        System.out.println(set.size());
    }

}
